import { BillboardController, getIcon } from '../utils'
import { useDataFetching } from './useDataFetching'
import { eventPointCoverage } from '../api'
import type { IconMap } from '../types'

export function usePlacementEventMark(billboardController: BillboardController, iconMap: IconMap) {
  // 处理撒点逻辑
  const { executeRequest } = useDataFetching<any[]>(eventPointCoverage, (data) => {
    // 撒点逻辑
    data = data.map((e) => ({ ...e, image: getIcon(e.eventTypeName, iconMap) }))
    billboardController.batchAdd(data)
  })

  return {
    executeRequest,
  }
}
